package hu;

import java.util.*;

public class hu_1_721 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long num = sc.nextLong();
        if(num < 0 || num > Math.pow(10,10)){
            System.out.println(-1);
            return;
        }
        if(num < 3){
            System.out.println(0);
            return;
        }
        String s = Long.toBinaryString(num);
        System.out.println(s);
        int n = s.length();
        long num2 = (long) (Math.pow(2, n - 1) + Math.pow(2, n / 2- 1));
        long num3 = (long) (Math.pow(2, n) - 1);
        int re = 0;
        for (int i = 2; i < n; i += 2) {
            re += Math.pow(2, i / 2 -1);
        }
        if(n % 2 == 1){
            System.out.println(re);
            return;
        }
        else if(num == num3){
            re += Math.pow(2, n / 2 - 1);
            System.out.println(re);
            return;
        }
        else if(num == num2){
            re += 1;
            System.out.println(re);
            return;
        }
        else{
            for (int i = n / 2; i < n - 1; i++) {
                if(num >= num2){
                    num2 += Math.pow(2, n) + Math.pow(2, i / 2 - 1);
                    re += Math.pow(2, i - n / 2) + 1;
                }
            }
        }
        System.out.println(re);
    }
}
